<template>
  <div>
    <ul class="right-entry">
      
      <li v-if="!loginUser" class="right-entry-item right-entry-item--upload v-popover-wrap">
        <login />
      </li>
      <li v-else>
        <hoveruser></hoveruser>
      </li>
      <a href="/message">
        <li class="v-popover-wrap right-entry-item">
          <div data-mod="top_bar" data-idx="message" class="right-entry__outside">
            <span class="right-entry-text">消息</span>
          </div>
        </li>
      </a>
      <a href="/dongtai">
        <li class="v-popover-wrap right-entry-item">
          <div data-mod="top_bar" data-idx="dynamic" class="right-entry__outside">
            <span class="right-entry-text">动态</span>
          </div>
        </li>
      </a>

      <a class="default-entry" href="/person/shoucang">
        <li class="v-popover-wrap right-entry-item">
          <div data-mod="top_bar" data-idx="fav" class="right-entry__outside">
            <span class="right-entry-text">收藏</span>
          </div>
        </li>
      </a>
      <a href="/history">
        <li class="v-popover-wrap right-entry-item">
          <div data-mod="top_bar" data-idx="history" class="right-entry__outside">
            <span class="right-entry-text">历史</span>
          </div>
        </li>
      </a>
      <a href="/upload">
        <li class="right-entry-item right-entry-item--upload v-popover-wrap">
          <div data-mod="top_bar" data-idx="upload">
            <div class="header-upload-entry">
              <span class="header-upload-entry__text">投稿</span>
            </div>
          </div>
        </li>
      </a>
    </ul>
  </div>
</template>

<script>
import login from "@/views/login/login";
import hoveruser from "@/views/personal/hoveruser";
export default {
  name: "headRight",

  data() {
    return {

      loginUser:'',
    };
  },
created(){
this.getLoginUser();
},

  methods: {
  getLoginUser() {
      this.axios({
        method: "get",
        params: {},
        url: "http://localhost:8090/user/getLoginUser"
      })
        .then(res => {
          //res.data就是请求后端成功后返回的数据
          this.loginUser = res.data;
         
        })
        .catch(error => {
          //每一个页面都刷新时都会请求一次app.vue的created里面的方法
          this.$message.error(error.response.data.message);
        });
    },


  },
  components: {
    login,
    hoveruser
  }
};
</script>
<style   scoped>
</style>